﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RedDragon.Common.Domain.warehouse;
using RedDragon.RBAC.API.Application.Common.WarehouseW;
using T.Common.Domain.Common;

namespace RedDragon.RBAC.API.Controllers
{
    /// <summary>
    /// 仓库控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class WarehouseController : ControllerBase
    {
        public readonly IMediator mediator;

        public WarehouseController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 仓库新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost("WareHouseAdd")]
        public async Task<Result> Handle(WarehouseCreateCommon request)
        {
            return await mediator.Send(request);

        }
        /// <summary>
        /// 仓库列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet("WareHouseList")]
        public async Task<Result> Handle([FromQuery]WarehouseSeachCommon request)
        {
            return await mediator.Send(request);
        }
    }
}
